package disruptor;

import java.time.LocalDateTime;

/**
 * @author dushougudu
 */
public class Consumer extends AbstractConsumer<String> {
    private String name;

    public Consumer(String name) {
        this.name = name;
    }

    @Override
    public void consume(String data) {
        System.out.println(Thread.currentThread().getId() + "##" + this.name + "：拿到队列中的数据：" + data);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    private String now() {
        LocalDateTime now = LocalDateTime.now();
        return "[" + now.getMinute() + ":" + now.getSecond() + "] ";
    }
}
